package com.codemonkey.lq.common.util;

public class JvmHelper {

	public static void main(String[] args) {

		System.out.println(" 内存信息 :" + printMemoryInfo());
	}

	// http://blog.csdn.net/lvyuan30276/article/details/50492926
	public static String printMemoryInfo() {

		Runtime currRuntime = Runtime.getRuntime();

		int nFreeMemory = (int) (currRuntime.freeMemory() / 1024 / 1024);

		int nTotalMemory = (int) (currRuntime.totalMemory() / 1024 / 1024);

		return nFreeMemory + "M/" + nTotalMemory + "M(free/total)";
	}
}
